/*
 * Attempt to solve the leaf eater problem.
 */

#include "stdafx.h"
#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long number;

number gcd(number a, number b)  {
	while(a != 0)  {
		if(a < b)  {
			number temp;
			temp = a; 
			a = b;
			b = temp;
		}
		// now a >= b
		a %= b;
	}
	return b;
}

inline number lcm(number a, number b)  {
	return a*b/gcd(a, b);
}
number lcm(number* inputs, int size)  {
	if(size == 1) return inputs[0];
	number curr_lcm = lcm(inputs[0], inputs[1]);

	for(int i = 2; i < size; i++) curr_lcm = lcm(curr_lcm, inputs[i]);
	return curr_lcm;
}

inline number count(number max, number lcm)  {
	return 1 +  (max - 1)/lcm;
}
void leaf_eater_main(void)  {
	int n, k; // n - is the number of leaves; k - number of caterpillars
	cin >> n >> k;

	vector<number> lengths(k);
	for(int i = 0; i < k; i++)
		cin >> lengths[i];

	number total = 0;
	number* elements = new number[k];
	// 1 << k is 2^k
	const int max = (1 << k);
	for(int i = 1; i < max; i++)  {
		int n_elems = 0, position = 0;
		int b_number = i;
		
		while(b_number)  {
			if(b_number & 1)  {
				elements[n_elems++] = lengths[position];
			}
			position++;
			b_number >>= 1;
		}
		number thisLcm = lcm(elements, n_elems);
		number cnt = count(n, thisLcm);

		if(n_elems & 1) total += cnt;
		else total -= cnt;
	}
	cout << n - total << endl;
}